#include <OatFractureScene.h>

COatFractureScene::COatFractureScene(SbVec2f origin, SbVec2f size)
{
	m_pScene = new PoSceneView;
	m_pScene->ref();
	m_pAnn = new SoAnnotation;
	m_pAnn->ref();
	m_pDomain = new PoDomain;
	m_pDomain->ref();
	m_pCamera = new SoOrthographicCamera;

	//pCamera->viewportMapping.setValue(SoCamera::LEAVE_ALONE);
	m_pCamera->position.setValue(.5f, .5f, 1);
	m_pCamera->pointAt(SbVec3f(.5f, .5f, 0));
	m_pCamera->height.setValue(1);

	m_pScene->isBorderVisible = false;
	m_pScene->viewportOrigin.setValue (origin);
	m_pScene->viewportSize.setValue(size);
	m_pScene->setPart ("scene", m_pAnn);
	m_pScene->setPart("cameraKit.camera", m_pCamera);
	m_pAnn->addChild (m_pDomain);
}

COatFractureScene::~COatFractureScene(void)
{
	m_pScene->unref();
	m_pDomain->unref();
	m_pAnn->removeAllChildren();
	m_pAnn->unref();
}

PoSceneView* COatFractureScene::GetView()
{
	return m_pScene;
}

SoCamera* COatFractureScene::GetCamera()
{
	return m_pCamera;
}

SoSeparator* COatFractureScene::GetAnnRoot()
{
	return m_pAnn;
}

void COatFractureScene::SetCamera(SoCamera* pCamera)
{
	m_pCamera = (SoOrthographicCamera*)pCamera;
	m_pScene->setPart("cameraKit.camera", m_pCamera);
}
